<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="./images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="./images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="./images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script> 
<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>

</head>
<body class="body_ifm">
<div class="infoboxp"> 
<div class="admin_new_tip">
<a href="javascript:;" class="admin_new_tip_close"></a>
<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
<div class="admin_new_tip_list_cont">
<div class="admin_new_tip_list">管理员根据网站运营需求，添加不同类型的管理员！管理员类型分为：“CRM、超级管理员、分站管理员”用户权限组成相关设置，超级管理员可以根据运营需求设置。</div>
</div>
</div>
<div class="clear"></div>



<div class="clear"></div>
<div class="common-form">
<div class="tag_box mt10">
<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe> 
<form name="myform" target="supportiframe" action="index.php?m=admin_user&c=savagroup" method="post" id="myform" class="layui-form">
<input type="hidden" name="pytoken" value="{yun:}$pytoken{/yun}">
<input type="hidden" value="{yun:}$admin_group[0]{/yun}" name="groupid" />
<table width="100%"  class="table_form ">
           <tbody>
  <tr class="admin_table_trbg">
    <th width="160" bgcolor="#f0f6fb"><span class="admin_bold">参数说明</span></th>
    <td bgcolor="#f0f6fb"><span class="admin_bold">参数值</span></td>   
  </tr>
 </tbody>
	<tr>
		<th width="100">用户组名称</th>
		<td  style="padding-left:10px;">
        <input type="text" name="group_name" id="realname" class="input-text" size="40" value="{yun:}$admin_group[1]{/yun}">
        </td>
	</tr>
	
   
	<tr>
		<th>用户组权限</th>
		<td>
        <div class="layui-collapse" lay-filter="test">
        
        {yun:}foreach item=v from=$navigation{/yun}
          <div class="layui-colla-item"  id="power{yun:}$v.id{/yun}">
            <h2 class="layui-colla-title">{yun:}$v.name{/yun}
            <input type="hidden" name="power[]" value="{yun:}if in_array($v.id,$power){/yun}{yun:}$v.id{/yun}{yun:}/if{/yun}" id="group{yun:}$v.id{/yun}" >
            </h2>
            <div class="layui-colla-content layui-show">
              <p>
              {yun:}foreach item=val from=$one_menu[$v.id]{/yun}
           <div class="layui-colla-item">
            <h2 class="layui-colla-title">{yun:}$val.name{/yun}
               <input type="hidden" name="power[]"  value="{yun:}if in_array($val.id,$power){/yun}{yun:}$val.id{/yun}{yun:}/if{/yun}" id="group{yun:}$val.id{/yun}" >

            </h2>
            <div class="layui-colla-content  layui-show">
              <p>
              
              <div class="layui-form-item">
        			<div class="layui-input-block" id="power{yun:}$val.id{/yun}"> 
                    {yun:}foreach item=value from=$two_menu[$val.id]{/yun}
                    <input type="checkbox" name="power[]" title="{yun:}$value.name{/yun}" value="{yun:}$value.id{/yun}" id="group{yun:}$value.id{/yun}" t1="{yun:}$v.id{/yun}" t2="{yun:}$val.id{/yun}" {yun:}if in_array($value.id,$power){/yun}checked="checked"{yun:}/if{/yun}  lay-filter="power" >
                	{yun:}/foreach{/yun}</div></div>
              
              </p>
            </div>
          </div>
              {yun:}/foreach{/yun}
              </p>
            </div>
          </div>
		{yun:}/foreach{/yun}

		</div>

    	</td>
	</tr>
	
	<tr>
		<td colspan="2" align="center" height="40" style="border-top:1px solid #CCC;">
           <input class="admin_button" name="add_group" type="submit" value="提交" id="dosubmit">
</td>
</table>
</form>
</div>
</div></div>
<script language="javascript">


  layui.use(['layer', 'form','element'], function(){
    var layer = layui.layer
    ,form = layui.form
	,element = layui.element
    ,$ = layui.$;
	  form.on('checkbox(power)', function(data){

		var id = data.elem.id;
		var t1 = $('#'+id).attr('t1');
		var t2 = $('#'+id).attr('t2');
		if(data.elem.checked){
			
			$("#group"+t1).val(t1);
			$("#group"+t2).val(t2);
			
			
		}else{
			var t1checked = 0;
			var t2checked = 0;
			$('#power'+t1+' input[type="checkbox"]:checked').each(function(){
			    t1checked = 1;
				return false;
		    });
			$('#power'+t2+' input[type="checkbox"]:checked').each(function(){
			    t2checked = 1;
				return false;
		    });
			if(t1checked!=1){
				$("#group"+t1).val('');
			}
			if(t2checked!=1){
				$("#group"+t2).val('');
			}
		}
	});
  });


</script>
</body>
</html>